import Vue from 'vue'
import Cookies from 'js-cookie'
import App from './App.vue'
import router from './router'
import store from './store'
import './assets/icons' // icon
import './permission'
import { download } from '@/utils/request'
import plugins from './plugins' // plugins
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import '@/assets/styles/index.scss'
import '@/assets/styles/project.scss'

// 头部标签组件
import VueMeta from 'vue-meta'
import { getDicts } from "@/api/system/dict/data";
import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/project";
// 字典标签组件
import DictTag from '@/components/DictTag'
// 字典数据组件
import DictData from '@/components/DictData'
// 自定义表格工具组件
import RightToolbar from "@/components/RightToolbar"
// 分页组件
import Pagination from "@/components/Pagination";

import directive from './directive' // directive
import { getConfigKey } from "@/api/system/config";

// 全局方法挂载
Vue.prototype.getDicts = getDicts
Vue.prototype.getConfigKey = getConfigKey
Vue.prototype.parseTime = parseTime
Vue.prototype.resetForm = resetForm
Vue.prototype.addDateRange = addDateRange
Vue.prototype.selectDictLabel = selectDictLabel
Vue.prototype.selectDictLabels = selectDictLabels
Vue.prototype.download = download
Vue.prototype.handleTree = handleTree

// 全局组件挂载
Vue.component('DictTag', DictTag)
Vue.component('RightToolbar', RightToolbar)
Vue.component('Pagination', Pagination)

DictData.install()

Vue.config.productionTip = false
Vue.prototype.download = download
Vue.use(directive)
Vue.use(plugins)
Vue.use(VueMeta)
Vue.use(ElementUI, {
  size: Cookies.get('size') || 'medium' // set element-ui default size
})

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
